<template>
  <div v-bind:id="id"></div>
</template>
<script>
  export default {
    name: "ChartComponents",
    props: {
      option: Object,
      id: Number
    },
    data(){
      return {
      }
    },
    mounted(){
      this.drawLine();
    },
    methods: {
      drawLine(){
        // let _this = this;
        // 基于准备好的dom，初始化echarts实例
        let dom = this.$echarts.init(document.getElementById(this.id));
        dom.setOption(this.option);
      }
    },
    watch: {
      option: function (newValue, oldValue) {
        this.drawLine();
      }
    }
  }
</script>
<style scoped>

</style>
